<?php

/*
|--------------------------------------------------------------------------
| Ship Helpers
|--------------------------------------------------------------------------
|
| Write only general helper functions here.
| Container specific helper functions should go into their own related Containers.
| All files under app/{section_name}/{container_name}/Helpers/ folder will be autoloaded by Apiato.
|
*/

use JetBrains\PhpStorm\Pure;

if (!function_exists('generateRandomInt')) {

    /**
     * Генерация числа
     * @param int $length
     * @return int
     */
    function generateRandomInt(int $length = 6): int
    {
        $key = '';
        for ($n = 0; $n < $length; $n++) {
            $key .= strval(rand(intval($n === 0), 9));
        }

        return intval($key);
    }
}
